var e = getApp();

Page({
    data: {
        show1: !1,
        customer_open: !0,
        service_QRcode: "",
        service_mobile: "",
        indexData: {},
        supplierInfo: {},
        id: "",
        infoData: {},
        cservice: ""
    },
    onLoad: function(e) {
        e.id && this.setData({
            id: e.id
        }), this.getIndexData(), this.getSupplierInfo();
    },
    onReady: function() {},
    onShow: function() {},
    onHide: function() {},
    onUnload: function() {},
    onPullDownRefresh: function() {},
    onReachBottom: function() {},
    onShareAppMessage: function() {},
    callPhone: function() {
        wx.makePhoneCall({
            phoneNumber: this.data.service_mobile
        });
    },
    showPop: function() {
        console.log("点击"), this.data.customer_open && this.setData({
            show1: !0
        });
    },
    closePop: function() {
        this.setData({
            show1: !1
        });
    },
    getIndexData: function() {
        var t = this, o = e.getNetAddresss("plugin.supplier.frontend.shop.index.index");
        o += "&sid=" + this.data.id, e._getNetWork({
            url: o,
            success: function(e) {
                var o = e.data;
                1 == o.result && t.setData({
                    indexData: o.data,
                    supplierInfo: o.data.supplier,
                    customer_open: "1" == o.data.customer_open,
                    cservice: o.data.cservice,
                    service_QRcode: o.data.service_QRcode,
                    service_mobile: o.data.service_mobile
                });
            },
            fail: function(e) {
                console.log(e.msg);
            }
        });
    },
    gotoChat: function(t) {
        var o = this.data.cservice;
        wx.navigateTo({
            url: o,
            fail: function(t) {
                e.tips("客服路由出错");
            }
        });
    },
    getSupplierInfo: function() {
        var t = this, o = e.getNetAddresss("plugin.supplier.frontend.shop.index.getSupplierInfo");
        o += "&sid=" + this.data.id, e._getNetWork({
            url: o,
            success: function(e) {
                var o = e.data;
                1 == o.result && t.setData({
                    infoData: o.data
                });
            },
            fail: function(e) {
                console.log(e.msg);
            }
        });
    },
    goToSupplierShop: function() {
        getCurrentPages().length > 1 ? wx.navigateBack() : wx.navigateTo({
            url: "/packageA/member/supplier/SupplierShop/SupplierShop?id=" + this.data.id
        });
    }
});